home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / gem / l_1199 / 970 < prev    next >
Internet Message Format  |  1994-08-27  |  16KB

  1. Date: Fri, 22 Jul 94 03:11 CDT
  2. From: ekl@sdf.lonestar.org (Evan K. Langlois)
  3. To: gem-list@world.std.com
  4. Subject: GEM apps, in general
  5. Precedence: bulk
  6.  
  7.  
  8. I'll post some code in my next message that handles button events.  Please
  9. compile it.  It demonstrates soem very simple and powerful ideas.  In fact,
  10. remove the printf's and stick in pointers to functions and you'll have a
  11. C program that manages button events very well.  Use ObjC messages for the
  12. printf's and it gets better.
  13.  
  14. The idea of the code is to show that you don't need to call graf_mkstate()
  15. a bunch of times in a loop.  How many art packages look for a click and 
  16. then call graf_mkstate() in a loop?   This prevents any other events and
  17. its wrong.  You can use timer events to animate an icon, and rectangle
  18. events for other effects, and still recieve redraw messages and such while
  19. a user is holding a button down - even recieve more button events!!
  20.  
  21. Now, why is holding the right mouse button down to click in a background
  22. window archaic?  Well, I think that holding the right button will stop
  23. a TOP message from being delivered (I don't remember nor care) and I know
  24. that until recently, most people did not know that GEM could handle more
  25. than one button at once without polling.
  26.  
  27. If the user clicks the mouse on a selectable and completely unobscured,
  28. visible object, then why not select it instead of topping the window?  Since
  29. there is a border area on most dialogs, you can use that to top it, and
  30. and partially obscured object can be used to top the window.  I know some
  31. of you are worried about not being to top a window - does the new condition
  32. or forcing the object to be completely visible satisfy your needs?
  33.  
  34. As for key events and the "top" window, you should note that the top window
  35. does always get key events - if you call a dialog a window (even a modal one).
  36. Also note that if you select something in the menu, like change font, then
  37. this affects the top window too .. but what if you have a dialog over that
  38. window?   What if "Change Font" calls up a dialog in a window?  If won't
  39. change the font of itself!!  It changes the font of a different window.
  40. Application focus and key focus are not always different.   
  41.  
  42. As for the sending of key events, I would like to propose an extension to
  43. the drag-drop protocol.  If you implement a drag, but the application you
  44. drag to doesn't support being dropped on, then you can still "pipe" ascii
  45. data to that window by sending a key event to the application for each
  46. character.  This will be painfully slow, but it will work.
  47.  
  48. As for point to type, make it an option in the app-defs file.  Its easy to
  49. do for one application, but making it global is kinda screwy as its basically
  50. doing finding the window, finding the app that owns the window, like drag/drop
  51. but then it sends a copy of teh key event the OS sent to the other app.
  52.  
  53. As to Ken and WinLIB Pro:
  54.  
  55. ========================================================================
  56. I'm simply saying that the foreground application gets more 'attention'
  57. than background tasks. No 'wasted' CPU time at all, just 're-allocated' CPU
  58. time. After all, the application the user is currently interacting with will
  59. be getting most of the mouse activity, don't you think? :-)
  60. ========================================================================
  61.  
  62. This statement is WRONG.  There are no foreground and background tasks.
  63. Think of it this way.  An application waiting for an event is not running
  64. and is not using the CPU.  An application that is executing code is
  65. running.  Under SingleTOS, or Geneva, while one application runs, no
  66. other application can be running, and when the AES is called, GEM begins
  67. to poll for events and either gives an event where it needs to, or lets the
  68. AES call return.  It determines things like how much two cuncurrent programs,
  69. like a DESK ACC and an APP (or with GENEVA multiple apps) on a round-robin
  70. basis, so every program gets more or less EQUAL CPU share.  Task switching
  71. only happens during an AES call.
  72.  
  73. Under MultiTOS, multiple applications runs at once, so when does the AES
  74. poll for events?  Answer - always.  Having programs run while another
  75. polls makes MultiTOS seem very slow, even if only one application is
  76. running, and more applications running means more code running at once.
  77. What is some of those programs don't block for evnt_multi and they use
  78. a 0ms timer to poll for events?   Well they will wind up using ALOT of
  79. CPU time slowing the system to a baby-crawl.  Just evnt_multi calling
  80. very often is ALOT of overhead, and then calling objc_find is worse.
  81. Doing all this during the MultiTOS polling is too much to handle.  And
  82. don't forget that you can have tasks that aren't GEM, and they will
  83. have to complete for CPU time too!!
  84.  
  85. Under the newer MultiTOS, instead of polling for events, interrupts trigger
  86. MiNT device drivers that wake up the AES and let it know an event is
  87. available.  This is ver yfast and efficient and it means that there is no
  88. more polling.  No polling means that when your app runs, it doesn't have to
  89. compete with the AES code polling the mouse in a tight loop, so it runs
  90. fast.  Also note that in neither version of MultiTOS do you need to give
  91. up CPU time.  You can do computations all day long and never make an AES
  92. call and the system will be fine (your windows get dirty though!).  Heavy
  93. computation is a good reason to use tfork() - it is backwards compatible
  94. to TOS (making it a single-tasking function call) and allow you to thread
  95. a long function call.
  96.  
  97. Using Timer events to poll means that one application will east CPU slices
  98. from every other program - those in windows, TOS background tasks, daemons,
  99. or other AES programs that attempt to do concurrent tasks.  These events
  100. are made by a programmer that assumes the user is using his program and
  101. is not using any other, and that the performance of the rest of the system
  102. is allowed to suffer to make his life easier.
  103.  
  104. This is simply bad programming.  There are better ways.  In General, your
  105. programs should always sit and wait for something to happen, NOT check and
  106. see if something is happening.  The first is highly efficient and is just
  107. as fast under single-TOS and will free an incredible amount of CPU under
  108. the new MultiTOS.  The second will be great under single-TOS, slow under
  109. MultiTOS and you will see it HOG the CPU under the new MultiTOS using simple
  110. utils like TOP.
  111.  
  112. ========================================================================
  113. I do not like the idea of having buttons function in background windows
  114. unless that particular dialog is INTENDED to work that way.  There should
  115. be options for doing this for things like tool boxes and multiple
  116. non-overlapping pannels, but otherwise, I like the way GEM works normally.
  117. ========================================================================
  118.  
  119. Give examples of where the guidelines I give above fail!  Using the desktop
  120. as a test, I only see benefits.
  121.  
  122. ========================================================================
  123. I'm not sure I follow your comment.  My -experience- is that I do not know
  124. assembly language, and therefore have no real use for an assembly level
  125. debugger.  What on earth can you possibly object to in that?
  126. ========================================================================
  127.  
  128. In my EXPERIENCE I have used both kinds of debuggers.  Both have their
  129. uses.  I do know assembly language, 3 or 4 of them, but I fail to see
  130. what ANY of this has to do with GEM.  Will using TIMER events slow the
  131. system?  Yes!   Why?   Because the program is running instead of waiting.
  132. Waiting means you are on a queue, ready for some other code to give you
  133. your fix so you jive again :-)   Running means your eating CPU and if you
  134. east CPU, you better do something GOOD with it since its limited resource.
  135. TIMER events are sent to every app that wants them, not just the top one.
  136. Calling evnt_multi means passing half a dozen parameters on the stack,
  137. including lots of LEA's, then copy lots of these to the intin/intout arrays,
  138. then lookup the control values to the calls (whoops, missed a JSR in there!
  139. this ain't C++, so its not inline), then we call a TRAP (and that takes
  140. forever in itself), no